/*
 * enc_type.h
 *
 *  Created on: 2018年10月16日
 *  Author: Degang.Wu (windragon@126.com)
 *  Desc:
 */

#ifndef ENC_TYPE_H_
#define ENC_TYPE_H_

#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <asm/ioctl.h>
#include "enc_eth.h"

typedef int8_t 						S8;
typedef int16_t						S16;
typedef int32_t						S32;
typedef int64_t						S64;
typedef uint8_t						U8;
typedef uint16_t					U16;
typedef uint32_t					U32;
typedef uint64_t					U64;
typedef int8_t*						pS8;
typedef int16_t*					pS16;
typedef int32_t*					pS32;
typedef int64_t*					pS64;
typedef uint8_t*					pU8;
typedef uint16_t*					pU16;
typedef uint32_t*					pU32;
typedef uint64_t*					pU64;

#define	 SZ_64B						(64)
#define	 SZ_128B					(128)
#define	 SZ_256B					(256)
#define	 SZ_512B					(512)
#define  SZ_1K						(1024)
#define  SZ_2K						(2*SZ_1K)
#define	 SZ_4K						(4*SZ_1K)
#define	 SZ_8K						(8*SZ_1K)
#define  SZ_16K						(16*SZ_1K)
#define  SZ_32K						(32*SZ_1K)
#define  SZ_64K						(64*SZ_1K)
#define  SZ_128K					(128*SZ_1K)
#define  SZ_256K					(256*SZ_1K)
#define  SZ_512K					(512*SZ_1K)
#define  SZ_1M						(1024*1024)
#define	  SZ_2M						(2*SZ_1M)
#define  SZ_4M						(4*SZ_1M)
#define  SZ_8M						(8*SZ_1M)
#define	  SZ_16M					(16*SZ_1M)
#define  SZ_32M						(32*SZ_1M)
#define  SZ_64M						(64*SZ_1M)
#define  SZ_128M					(128*SZ_1M)
#define  SZ_256M					(256*SZ_1M)
#define  SZ_512M					(512*SZ_1M)

#ifdef MAX_PATH
#undef MAX_PATH
#endif
#define  MAX_PATH					(256)


#define bw_max(a, b)            (((a) > (b)) ? (a) : (b))
#define bw_min(a, b)            (((a) < (b)) ? (a) : (b))
#define bw_between(_Left, _Right, _Value)    ( (_Value)>=(_Left) && (_Value)<=(_Right) )
#define BW_ARRAY_LEN(a)			(sizeof(a)/sizeof(a[0]))

#define BW_CHAR					(char*)

typedef struct _ENC_RAW_SOCK_BUF
{
	U8			init_flag;
	U32			sipaddr;
	U16			sipport;
	U32			dipaddr;
	U16			dipport;
	U8			shwaddr[6];		// src mac
	U8			dhwaddr[6];		// dst mac
	struct sockaddr_ll device;

	st_packethdr	pkthdr;
}stENC_RAW_SOCK_SET, *pENC_RAW_SOCK_SET;

#endif /* ENC_TYPE_H_ */
